package org.example.aggregation.dto;

public class CatDto implements AggregationDto<String, CatDto>{

    private String name;

    private Integer age;

    public CatDto(String name, Integer age){
        this.name = name;
        this.age = age;
    }

    @Override
    public String uniqueKey() {
        return name;
    }

    @Override
    public CatDto concat(CatDto ad) {
        if(ad == null){
            return this;
        }
        this.age = (this.age==null?0:this.age) + (ad.age==null?0:ad.age);
        return this;
    }

    public String getName() {
        return name;
    }

    public Integer getAge() {
        return age;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setAge(Integer age) {
        this.age = age;
    }
}
